;(function (root) {

	"use strict";

	var UMath = function () {};

	UMath.prototype = {

		constructor: UMath,

		/**
		 * 计算经纬度两点的距离
		 * @param {Number} lat1 纬度1
		 * @param {Number} lng1 经度1
		 * @param {Number} lat2 纬度2
		 * @param {Number} lng2 经度2
		 * @return {Number} 距离（米）
		 */
		getGreatCircleDistance: function (lat1, lng1, lat2, lng2){
			var EARTH_RADIUS = 6378137.0; //单位：米
			var PI = Math.PI;
			var getRad = function (d){
				return d * PI / 180.0;
			};
			var radLat1 = getRad(lat1);
			var radLat2 = getRad(lat2);
			var a = radLat1 - radLat2;
			var b = getRad(lng1) - getRad(lng2);
			var s = 2 * Math.asin(
				Math.sqrt(Math.pow(Math.sin(a/2),2)
					+ Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b/2),2))
			);
			s = s * EARTH_RADIUS;
			s = Math.round(s * 10000) / 10000.0;
			return s;
		}

	};


	if(root["UMath"] === undefined) {
		var f = function () {};
		f.prototype = UMath.prototype;
		root["UMath"] = new f();
	} else {
		console.error("UMath has been defined.");
	}

})(this);